package com.guoyihao.oj.judge.codesandbox;

import com.guoyihao.oj.judge.codesandbox.impl.RemoteCodeSandBox;
import com.guoyihao.oj.judge.codesandbox.impl.ThirdPartyCodeSandBox;
import com.guoyihao.oj.judge.codesandbox.impl.ExampleCodeSandBox;

/**
 * 代码沙箱工厂
 */
public class CodeSandBoxFactory {
    /**
     * 根据类型创建代码沙箱实例
     * @param type
     * @return
     */
    public static CodeSandBox newInstance(String type){
        switch (type){
            case "example":
                return new ExampleCodeSandBox();
            case "remote":
                return new RemoteCodeSandBox();
            case "thirdParty":
                return new ThirdPartyCodeSandBox();
            default:
                return new ExampleCodeSandBox();
        }
    }
}
